<%@ page language="java" import="java.util.*" pageEncoding="utf-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE>
<html>
<head>
    <title>My JSP 'add.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <title>添加帖子</title>
    <c:import url="common.jsp"></c:import>

    <link rel="stylesheet" href="${zts}/statics/kindeditor/themes/default/default.css"/>
    <script charset="utf-8" src="${zts}/statics/kindeditor/kindeditor-min.js"></script>
    <script charset="utf-8" src="${zts}/statics/kindeditor/lang/zh_CN.js"></script>
    <script>
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="content"]', {
                allowFileManager: true
            });
        });

        function getIM() {
            alert(editor.html());
            $('textarea[name="content"]').html(editor.html());
            $("#form1").submit();
        }
    </script>
</head>

<body>
<!-- 导航 -->
<c:import url="nav.jsp"></c:import>

<div style="text-align: center; width: 800px; margin: 0 auto">
    <form id="form1" action="addsave.action" method="post">
        <div class="form-group">
            <label for="title" style="font-size: large;font-weight: bold">标题</label>
            <input type="text" class="form-control" id="title" name="title" placeholder="请输入名称">
        </div>
        <div class="form-group">
            <label for="summary" style="font-size: large;font-weight: bold">概要</label>
            <input type="text" class="form-control"
                   id="summary" name="summary" maxlength="200" placeholder="请输入概要">
        </div>
        <div class="form-group">
            <label for="author" style="font-size: large;font-weight: bold">作者</label>
            <c:if test="${currentUser==null}">
                <input type="text" class="form-control"
                       id="author" name="author" value="请先登录！！！"
                       readonly="readonly">
            </c:if>
            <c:if test="${currentUser!=null}">
                <input type="text" class="form-control"
                       id="author" name="author" value="${currentUser.name}"
                       readonly="readonly">
            </c:if>

        </div>
        <div class="form-group">
            <textarea name="content" style="width: 800px;height: 500px">
                Please write down your words here
            </textarea>
        </div>
        <button type="button" class="btn btn-primary"
                onclick="getIM()">SUBMIT
        </button>
        <%--        <input type="button" onclick="getIM()" value="提交" class="btn">--%>
    </form>
</div>
</body>
</html>
